<?php


class CtableHelper extends AppHelper {
   var $helpers = array('Html');
    /** ********************************************************************************
     * bang: de hien thi
     * ********************************************************************************/	
    
  
    
  function bang($model,$cot,$dong,$data=array()){
    $n=count($cot);
    $m=count($dong);
    
    $kq='<table id="tables">';  
    //for($i=-1;$i<$m;$i++){
    
    $kq.='<tr>';
    $kq.='<th rowspan="2">Mã số sv</th>';
    $kq.='<th rowspan="2">Họ tên</th>';
    $kq.='<th colspan="12">Tháng</th>';
    $kq.='</tr>';
    
    //$kq=$kq. '<th>Tháng</th>';
               
            
    foreach($cot as $k=>$c):
        $kq=$kq. '<th><b><font color="#CC0909">'.
                      $c.'</font></b></th>';
                  
   endforeach; 
  
    $i=0;   
    foreach ($dong as $key=>$d):
        $kq.='<tr>';
        
        
            $kq.='<td>'.$key.'</td><td>'.$d.'</td>';
            foreach($cot as $k=>$c):
            //ghep id cua thang_mssv vao value
                  if(in_array($k.'_'.$key,$data))
            //kiem tra nếu đã có dữ liệu, tức là có đóng đoàn phí thì check vào
                    $kq=$kq. '<td><input type="checkbox" name="data['.$model.'][dadong][]" value="'.$k.'_'.$key.'" checked="yes">
                      </input></td>';
                  else
                    $kq=$kq. '<td><input type="checkbox" name="data['.$model.'][dadong][]" value="'.$k.'_'.$key.'">
                      </input></td>';
                  
                  
            endforeach;  
        
                    
        $kq.='</tr>';
        
        $i++;
        
     endforeach;  
    //}
    
    $kq.='</table>';
    
    return $kq;
    
    
  }


  
}
 ?>